wayland: Don't trigger grab on missing capabilities
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 21 Dec 2015 18:13:41 +0000 (19:13 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 21 Dec 2015 18:14:21 +0000 (19:14 +0100)
Those might not be currently there in the first place.

gdk/wayland/gdkdevice-wayland.c

index 7afc30fc65cb3045bb9c65a74bf6ef2a82782824..969ed96f5858aebe5cf539ba9b0773873cbb80fc 100644 (file)
@@ -2438,7 +2438,8 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
       return GDK_GRAB_NOT_VIEWABLE;
     }
 
-  if (capabilities & GDK_SEAT_CAPABILITY_POINTER)
+  if (wayland_seat->master_pointer &&
+      capabilities & GDK_SEAT_CAPABILITY_POINTER)
     {
       GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_pointer);
 
@@ -2461,7 +2462,8 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
       gdk_wayland_device_update_window_cursor (wayland_seat);
     }
 
-  if (capabilities & GDK_SEAT_CAPABILITY_TOUCH)
+  if (wayland_seat->touch_master &&
+      capabilities & GDK_SEAT_CAPABILITY_TOUCH)
     {
       GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->touch_master);
 
@@ -2481,7 +2483,8 @@ gdk_wayland_seat_grab (GdkSeat                *seat,
                                     FALSE);
     }
 
-  if (capabilities & GDK_SEAT_CAPABILITY_KEYBOARD)
+  if (wayland_seat->master_keyboard &&
+      capabilities & GDK_SEAT_CAPABILITY_KEYBOARD)
     {
       GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_keyboard);